package com.ruoyi.web.zbAdmin.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.zbAdmin.domain.CaiAddress;
import com.ruoyi.web.zbAdmin.mapper.CaiBaseUserMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags="才能招标-首页公共接口")
@RestController
@RequestMapping("/zbApi/index")
@Slf4j
public class IndexController {

    @Autowired
    private CaiBaseUserMapper mapper;

    @GetMapping("/findAllAddress")
    @ApiOperation(value = "查询所有的地区信息")
    public AjaxResult findAllAddress(){
        MongoTemplate template = mapper.getMongoTemplate();
        List<CaiAddress> all = template.findAll(CaiAddress.class,"cai_address");

        return AjaxResult.success("成功",all);

    }
}
